<template>
  <el-row :gutter="20">
    <el-col
      :span="6"
      :xs="{ span: 24 }"
      :sm="{ span: 12 }"
      :md="{ span: 6 }"
      v-for="item in dataList"
      :key="item.id"
      @click="handleClick(item)"
    >
      <div :style="{ height: height }" class="space-inner"> 

        <div class="lycard">
          <div class="space-header">
            <div class="space-header-title">{{ item.title }}</div>
            <div class="space-header-extend-right">
              <!-- <el-tag :type="item.time.type">
                                {{item.time.name}}
                            </el-tag> -->
            </div>
          </div>
          <el-skeleton
            :rows="rows"
            :animated="animated"
            :count="count"
            :loading="loading"
            style="padding: 20px; width: auto; overflow: hidden"
          >
            <template #default>
              <div class="space-main">
                <div class="space-main-up"> 
                  <span style="font-size: 24px;font-weight: 800;" >{{ countDatas?.[item.count_key]||0  }}</span>

                  <!-- <div class="space-main-icon">
                                        <el-avatar :size="50" :icon="item.icon.type" :style="{background:item.icon.background?item.icon.background:null}" />
                                    </div> -->
                </div>
                <div class="space-main-down">
                  <div> 
                    <el-space   spacer="|"> 
                      <el-link type="primary" v-for="other in item.otherArr"  :key="other" class="linkcolor"
                        >{{ other.compute }}个{{ other.title }}</el-link
                      >
                    </el-space>
                  </div> 
                </div>
              </div>
            </template>
          </el-skeleton>
        </div>
      </div>
    </el-col>
  </el-row>
</template>

<script>
export default {
  name: "LyGrowcardOne",
  data() {
    return {
      dataList: "",
    };
  },
  created() {
    this.dataList = this.modelValue;
  },
  props: {
    countDatas: {
      type: Object,
      default: () => {}, 
    },
    loading: {
      type: Boolean,
      default: true,
    },
    direction: {
      type: String,
      default: "horizontal",
    },
    alignment: {
      type: String,
      default: "flex-start",
    },
    count: {
      type: Number,
      default: 1,
    },
    rows: {
      type: Number,
      default: 4,
    },
    animated: {
      type: Boolean,
      default: true,
    },
    modelValue: {
      type: Array,
      default: [],
    },
    height: {
      type: Number,
      default: 200,
    },
  }, 
  watch: {
    modelValue: function (nval) {
      this.dataList = nval;
    },
    dataList: function (nval) {
      this.$emit("update:modelValue", nval);
    },
  },
  methods: {
    handleClick(item) {
      // this.$emit("click", item);
      console.log(item,'-------item');
      let routerObj={
        name: item.tourl,
      }
      if(item.query) routerObj.query=item.query;
      this.$router.push(routerObj);
    },
  },
};
</script>

<style scoped>
.space-inner {
}
.lycard {
    /* #409eff */
  background: rgba(236, 236, 236, 0.3);
  /* background: rgba(64, 158, 255, 0.09); */

  padding: 10px 0;
  box-sizing: border-box;
  /* background: var(--el-bg-color); */
  /* box-shadow: var(--el-box-shadow-light); */
  /* border: 1px solid var(--el-border-color-light); */
}
.linkcolor{
    color: rgb(101, 155, 224);
}
.space-header {
  /* border-bottom: 1px solid var(--el-color-info-light-7); */
  font-size: 14px;
  padding: 2px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.space-header-title {
  padding: 8px 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  margin-left: 10px;

}
.space-header-extend-right {
  padding: 8px 0;
  margin-right: 10px;
}
.space-main {
  padding: 10px 20px; 
}
.space-main-icon {
}
.space-main-up {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.space-main-down {
  /* margin-top: 15px; */
  min-height: 20px; 
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}
.space-main-down span{
    color: #333333;

}
::v-deep(.el-col) {
  margin-bottom: 11px;
}
</style>